package main.java.org.mapper;

import main.java.Exam.pojo.Entity.Operatorlog;
import main.java.Exam.pojo.Entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AdminMapper {

    @Select("select * from tb_user where role_id =#{roleId} limit #{page} ,#{pageSize}")
    List<User> getPageStudent(int roleId, Integer page, Integer pageSize);
    @Select("select Count(*) from tb_user where role_id=1")
    int getTotalStudent(int roleId);
    @Insert("insert into tb_user(userAccount,userName,phone,role_id)values( #{userAccount},#{userName},#{phone},#{roleId})")
    void insertData(User user);
    @Update("update tb_user set role_id=#{roleId} where userAccount=#{userAccount}")
    void updata(String userAccount, Integer roleId);
   @Delete("delete from tb_user where userAccount=#{userAccount}")
    void deleteData(String userAccount);
   @Select("select * from tb_user where userAccount=#{userAccount}")
    User selectData(String userAccount);
@Select("select * from tb_user where id=#{userId}")
    User getIdUser(Integer userId);
    @Select("select id from tb_user where userAccount=#{userAccount}")
    Integer selectIDD(String userAccount);
@Insert("insert into tb_log (operator_account,operator_name,module,operation_type,operation_time, result,content)values " +
        "(#{operatorAccount},#{operatorName},#{module},#{operationType},#{operationTime},#{result},#{content})")
    void insertLog(Operatorlog operatorlog);
    @Select("select * from tb_log limit #{page} ,#{pageSize}")
    List<Operatorlog> getLog(int page, Integer pageSize);
    @Select("select Count(*) from tb_log")
    int getLogCount();
}
